package com.amazon.ags.client;

import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
import android.util.Log;
import com.amazon.ags.api.RequestResponse;
import com.amazon.ags.overlay.PopUpManager;

public abstract class BaseReplyMessengerFactory<T extends RequestResponse>
{
  private static final String FEATURE_NAME = "GC";
  private static final String TAG = "GC_" + BaseReplyMessengerFactory.class.getSimpleName();
  protected final PopUpManager popUpManager = PopUpManager.getInstance();

  public BaseReplyMessengerFactory(Context paramContext)
  {
  }

  public final Messenger getReplyHandleMessenger(GCResponseHandleImpl<T> paramGCResponseHandleImpl)
  {
    return new Messenger(new ServiceHandleHandler(paramGCResponseHandleImpl));
  }

  protected abstract T processMessage(Message paramMessage);

  private class ServiceHandleHandler extends Handler
  {
    private GCResponseHandleImpl<T> handle;

    public ServiceHandleHandler()
    {
      Log.d(BaseReplyMessengerFactory.TAG, "Constructing a ServiceHandleHandler for the outgoing asynchronous event");
      Object localObject;
      this.handle = localObject;
    }

    public void handleMessage(Message paramMessage)
    {
      RequestResponse localRequestResponse = BaseReplyMessengerFactory.this.processMessage(paramMessage);
      if (localRequestResponse == null);
      while (this.handle == null)
        return;
      Log.d(BaseReplyMessengerFactory.TAG, "Setting handle data with response: " + localRequestResponse.toString());
      this.handle.setResponse(localRequestResponse);
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.amazon.ags.client.BaseReplyMessengerFactory
 * JD-Core Version:    0.6.2
 */